/**
 * Copyright (C), 2019-2023,
 * FileName: TestCLient
 * Author:   fanxquer
 * Date:     2023/7/6 10:36
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 邱富康           2023/7/6           1.0
 */
package com.hsteach.framework.feign.client.auth;

import com.alibaba.fastjson2.JSONObject;
import com.hsteach.framework.feign.ClientConstant;
import com.hsteach.framework.feign.client.auth.dto.AuthResp;
import com.hsteach.framework.feign.client.xgk.dto.XgkList;
import com.hsteach.framework.feign.client.xgk.dto.XgkListResp;
import com.hsteach.framework.feign.client.xgk.dto.XgkListResult;
import com.hsteach.framework.feign.client.xgk.dto.XgkResult;
import com.hsteach.framework.feign.client.xgk.dto.ret.AreaClassRet;
import com.hsteach.framework.feign.client.xgk.dto.ret.AreaStudentRet;
import com.hsteach.framework.feign.client.xgk.dto.ret.AreaSchoolRet;
import feign.HeaderMap;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 〈〉
 *
 * @author Qiu Fukang
 * @create 2023/7/6
 * @since 1.0.0
 */
@FeignClient(name = "authClient", url = "${interface.auth.domain:127.0.0.1:8079}", configuration = AuthFeignConfig.class)
public interface AuthClient {

    /**
     * 获取用户登录基本信息
     * @return
     */
    @GetMapping("/auth/auth/user/info")
    AuthResp<JSONObject> userBasicInfo(@RequestHeader(ClientConstant.AUTH_ACCESS_TOKEN) String accessToken,
                                       @RequestHeader(ClientConstant.AUTH_APP_TOKEN) String appToken,
                                       @RequestParam("prvRequired") Integer prvRequired);

    /**
     * 获取应用私钥 appToken
     * @return
     */
    @PostMapping("/auth/auth/app/token")
    AuthResp<JSONObject> getAppToken(@RequestParam("appId") String appId, @RequestParam("appKey") String appKey);

    /**
     * 获取用户登录 token
     * @return
     */
    @PostMapping("/auth/auth/token")
    AuthResp<JSONObject> getAccessToken(@RequestParam("name") String name, @RequestParam("password") String password);

    /**
     * 获取区域老师数据
     * @return
     */
    @GetMapping("/system/uapi/edugov/teacher/info")
    AuthResp<JSONObject> edugovTeacherInfo(@HeaderMap HttpHeaders headers,
                                     @RequestParam("id") String id,
                                     @RequestParam("userId") String userId,
                                     @RequestParam("teacherId") String teacherId,
                                     @RequestParam("organizeId") String organizeId);

    /**
     * 获取学校教职工数据
     * @return
     */
    @GetMapping("/school/uapi/school/zxx/teacher/info")
    AuthResp<JSONObject> teacherInfo(@RequestHeader(ClientConstant.AUTH_ACCESS_TOKEN) String accessToken,
                                     @RequestHeader(ClientConstant.AUTH_APP_TOKEN) String appToken,
                                     @RequestHeader(ClientConstant.AUTH_OPERATE_CODE) String operateCode,
                                     @RequestParam("id") String id,
                                     @RequestParam("userId") String userId,
                                     @RequestParam("teacherId") String teacherId,
                                     @RequestParam("organizeId") String organizeId);

    /**
     * 获取取家长信息
     * @return
     */
    @GetMapping("/school/uapi/school/zxx/parent/info")
    AuthResp<JSONObject> parentInfo(@RequestHeader(ClientConstant.AUTH_ACCESS_TOKEN) String accessToken,
                                    @RequestHeader(ClientConstant.AUTH_APP_TOKEN) String appToken,
                                    @RequestHeader(ClientConstant.AUTH_OPERATE_CODE) String operateCode,
                                    @RequestParam("id") String id);

    /**
     * 获取学校所有学生
     * @return
     */
    @GetMapping("/school/uapi/school/zxx/student/list")
    XgkListResult<AreaStudentRet> getStudentBySchoolId(@RequestHeader(ClientConstant.AUTH_ACCESS_TOKEN) String accessToken,
                                                     @RequestHeader(ClientConstant.AUTH_APP_TOKEN) String appToken,
                                                     @RequestHeader(ClientConstant.AUTH_OPERATE_CODE) String operateCode,
                                                     @RequestParam("schoolId") String schoolId);

    /**
     * 获取双流区所有学校
     * @return
     */
    @GetMapping("/school/uapi/school/list")
    XgkListResult<AreaSchoolRet> getSchool(@RequestHeader(ClientConstant.AUTH_ACCESS_TOKEN) String accessToken,
                                           @RequestHeader(ClientConstant.AUTH_APP_TOKEN) String appToken,
                                           @RequestHeader(ClientConstant.AUTH_OPERATE_CODE) String operateCode);

    /**
     * 根据学校id获取所有班级
     * @return
     */
    @GetMapping("/school/uapi/school/zxx/eclass/pagelist")
    XgkResult<XgkList<AreaClassRet>> getAllClassBySchoolId(@RequestParam("pageSize")Integer pageSize,
                                                           @RequestParam("schoolId")String schoolId,
                                                           @RequestHeader(ClientConstant.AUTH_ACCESS_TOKEN)String accessToken,
                                                           @RequestHeader(ClientConstant.AUTH_APP_TOKEN)String appToken,
                                                           @RequestHeader(ClientConstant.AUTH_OPERATE_CODE)String operateCode);

    /**
     * 根据学校id获取所有年级名称
     * @return
     */
    @GetMapping("/standard/oapi/standard/dictionary/list")
    JSONObject getGrandName(@RequestHeader(ClientConstant.AUTH_ACCESS_TOKEN) String accessToken,
                            @RequestHeader(ClientConstant.AUTH_APP_TOKEN) String appToken,
                            @RequestHeader(ClientConstant.AUTH_OPERATE_CODE) String operateCode);
}